package com.itheima.zuoye.zy2;

import java.util.*;

public class Test {
    public static void main(String[] args) {
        Map<String, List<Student>> map = new HashMap<>();
        List<Student> class1 = new ArrayList<>();
        class1.add(new Student("20240101", "张三", 7));
        class1.add(new Student("20240102", "李四", 7));
        class1.add(new Student("20240201", "王五", 8));
        class1.add(new Student("20240202", "赵六", 8));
        class1.add(new Student("20240203", "孙七", 7));

        map.put("一年级一班", class1);

        map.forEach((clazz, students) -> {
            students.stream()
                    .sorted(Comparator.comparingInt(Student::getAge))
                    .forEach(stu ->
                            System.out.println("[" + clazz + "] " + stu)
                    );
            System.out.println("---------------------");
        });

    }
}
